<template>
  <ul class="catagtory">
    <li
      :class="{ select: current === i.id }"
      v-for="i in list"
      :key="i.id"
      @click="btn(i.id)"
    >
      {{ i.name }}
    </li>
  </ul>
</template>

<script>
import { mapState } from "vuex";
export default {
  data() {
    return {};
  },
  created() {
    this.$store.dispatch("type/getTypeList");
  },
  methods: {
    btn(id) {
      this.$store.commit("type/SETCURRENT", id);

      this.$store.dispatch("list/getArtList", id);
    },
  },
  components: {},
  computed: {
    ...mapState("type", ["list", "current"]),
  },
  watch: {},
};
</script>

<style scoped lang="less"></style>
